package com.zhiyou100.dao.impl;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.zhiyou100.dao.UserDao;
import com.zhiyou100.model.User;

@Repository
public class UserDaoImpl implements UserDao{
	
	@Autowired
	private SessionFactory factory;
	@Override
	public User checkUser(String email, String password) {
		String hql="from User u where u.email=? and u.password=?";
		return (User) factory.getCurrentSession().createQuery(hql).setParameter(0, email).setParameter(1, password).uniqueResult();
	}

	
}
